<?php

use think\migration\Migrator;
use think\migration\db\Column;

class Withdrawals extends Migrator
{
    public function up()
    {
        $table = $this->table('withdraw_deposits',array('comment' => '提现金流水'));
        $table->addColumn('user_id', 'integer', array('comment' => '会员id'))
              ->addColumn('amount', 'integer', array('default' => 0, 'comment' => '金额'))
              ->addColumn(Column::tinyInteger('status')->setComment('提现状态'))
              ->addColumn('currency', 'string', array('limit' => 4,'default' => 'CNY', 'comment' => '货币单位'))
              ->addColumn('bank_num', 'string', array('limit' => 255,'default' => '', 'comment' => '银行卡号'))
              ->addColumn('open_bank', 'string', array('limit' => 255,'default' => '', 'comment' => '开户行'))
              ->addColumn('created_at', 'timestamp', array('default' => 'CURRENT_TIMESTAMP'))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addIndex('id')
              ->addIndex('user_id')
              ->save();   
    }
    public function down()
    {
        $this->dropTable('withdraw_deposits');
    }
}
